package com.situ.cst.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.situ.cst.service.CstLinkmanService;
import com.situ.cst.entity.CstLinkman;
import com.situ.util.*;
/**
 * CstLinkman的路由接口服务
 * 
 * @author 
 *
 */
@RestController
public class CstLinkmanController {

	/** CstLinkmanService服务 */
	@Autowired
	private CstLinkmanService cstLinkmanService;
	
	/**
	 * 查询所有CstLinkman数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryCstLinkman", produces = {"application/json;charset=UTF-8"})
	public ResponseData find(CstLinkman value) {

		return ResponseData.ok().putDataValue("list",cstLinkmanService.find(value));
	}
	
	/**
	 * 通过id查询CstLinkman数据的方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "queryCstLinkmanById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData findOne(@PathVariable(name="id") Integer id) {
		 return ResponseData.ok().putDataValue("obj",cstLinkmanService.findOne(id));
	}
	
	/**
	 * 插入CstLinkman属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "saveCstLinkman")
	public ResponseData save(CstLinkman value) {
		return ResponseData.ok().putDataValue("obj", cstLinkmanService.saveNotNull(value));
	}
	
	/**
	 * 更新CstLinkman属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "updateCstLinkman", produces = {"application/json;charset=UTF-8"})
	public ResponseData update(CstLinkman value) {
		return ResponseData.ok().putDataValue("obj",cstLinkmanService.updateNotNullById(value));
	}

	/**
	 * 通过id删除CstLinkman数据方法
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "delCstLinkmanById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData delete(@PathVariable(name="id") Integer id) {
		return ResponseData.ok().putDataValue("obj",cstLinkmanService.deleteById(id));
	}
}
